/*
 * Product.java
 *
 * Created on 13 novembre 2007, 15:15
 */
package com.reimscopie;


/**
 * The super class product include the name and a
 * short description of the product.
 *
 * <p>It will be extended by all of the different types of product.
 */
public abstract class Product extends Value{
    
  // name of the product
  private String name ;
  
  // a description of the product
  private String description;
  
  // the list of comment for this product
  private Comment[] comments ;
  
  // valid or obsolete product
  private boolean valid ;
  
  // a picture of the product
  private String picture ;
  
  
  /**
   * Create a new <code>Product</code> instance with all attributes. This
   * object has no image in the database.
   *
   * @param name The name of the product.
   * @param description The description of the product.
   * @param picture The picture of this product.
   * @param valid The product is valid or obsolete.
   */
  public Product(String name,String description,String picture,boolean valid) {
    
    super() ;
    
    this.name        = name ;
    this.description = description ;
    this.valid       = valid ;
    this.picture     = picture ;
    
    comments = new Comment[0] ;
    
  }
  
  
  /**
   * Create a new <code>Product</code> instance with an image in the database.
   *
   * @param id The product id in the database.
   * @param name The name of the product.
   * @param description The description of the product.
   * @param picture The picture of this product.
   * @param valid The product is valid or obsolete.
   * @param comments The product comments.
   */
  public Product(long id,String name,String description,String picture,
      boolean valid,Comment[] comments) {
    
    super(id) ;
    
    this.name        = name ;
    this.description = description ;
    this.valid       = valid ;
    this.picture     = picture ;
    
    this.comments = comments ;
  }
  
  
  /**
   * Return the name of this product.
   *
   * @return The name of this product.
   */
  public String getName() {
    return name ;
  }
  
  
  /**
   * Return a short description of this product.
   *
   * @return The description of this product.
   */
  public String getDescription() {
    return description ;
  }
  
  
  /**
   * Return the name of the picture.
   *
   * @return The picture of this product.
   */
  public String getPicture() {
    return picture ;
  }
  
  
  /**
   * Return the comment list of comments for this product.
   *
   * @return All comments for this product.
   */
  public Comment[] getComments() {
    return comments ;
  }
  
  
  /**
   * Returns if this product is valid. 
   *
   * @return <code>true</code> if the product is valid.
   */
  public boolean isValid() {
    return valid ;
  }
  
  
  /**
   * Return the total cost of one unit of this product.
   *
   * @return The total cost of this product.
   */
  public abstract float getTotalCost() ;
  
}
